//
//  AbstactTabViewController.m
//  WDFans
//
//  Created by Zhihong Yuan on 1/31/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "AbstractTabViewController.h"

@implementation AbstractTabViewController


- (void)addBackgroundColor
{
//    UIImageView *bgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320.f, 460.f)];
//    bgView.image = [UIImage imageNamed:kNameOfBgImage];
//    [self.view addSubview:bgView];
//    [self.view sendSubviewToBack:bgView];
//    [bgView release];
}

- (void)setBackgroundImageViewForRegisterView
{
    [self addBackgroundColor];
//    UIImageView *bgFrameView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320.f, 416.f)];
//    bgFrameView.image = [UIImage imageNamed:@"bg_bottomFrame.png"];
//    [self.view addSubview:bgFrameView];
//    [self.view bringSubviewToFront:bgFrameView];
//    [bgFrameView release];
}

- (void)setBackgroundImageViewForPresentedView
{
    [self addBackgroundColor];
//    UIImageView *bgFrameView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 44.f, 320.f, 416.f)];
//    bgFrameView.image = [UIImage imageNamed:@"bg_bottomFrame.png"];
//    [self.view addSubview:bgFrameView];
//    [self.view bringSubviewToFront:bgFrameView];
//    [bgFrameView release];
}

- (void)setBackgroundImageViewForTabView
{

    [self addBackgroundColor];
//    UIImageView *bgFrameView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320.f, 367.f)];
//    bgFrameView.image = [UIImage imageNamed:@"bg_bottomFrame.png"];
//    [self.view addSubview:bgFrameView];
//    [self.view bringSubviewToFront:bgFrameView];
//    [bgFrameView release];
}
- (void)setBackgroundImageViewForSelfWithImage:(NSString *)imageName
{
//    UIImage *bgImg = [UIImage imageNamed:imageName];
//    
//    if(SYSTEW_VERSION_LESS_THAN(@"5.0"))
//        bgImg = [bgImg stretchableImageWithLeftCapWidth:0 topCapHeight:0];
//    else
//        bgImg =[bgImg resizableImageWithCapInsets:UIEdgeInsetsZero];
//    self.view.backgroundColor = [UIColor colorWithPatternImage:bgImg];
}

- (IBAction)rightItemClicked
{
    //must be implemented in subclass
}
- (IBAction)leftItemClicked
{
    //must be implemented in subclass
}

- (void)addNaviBarLeftItemWithTitle:(NSString *)title
{
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStylePlain target:self action:@selector(leftItemClicked)];
    self.navigationItem.leftBarButtonItem = leftItem;
    [leftItem release];
}


- (void)addNaviBarRightItemWithTitle:(NSString *)title
{
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStylePlain target:self action:@selector(rightItemClicked)];
    self.navigationItem.rightBarButtonItem = rightItem;
    [rightItem release];
}

- (void)addNaviBarRightRefreshItem
{
    UIBarButtonItem *refreshItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(rightItemClicked)];
    self.navigationItem.rightBarButtonItem = refreshItem;
    [refreshItem release];
}

- (void)addNaviBarLeftRefreshItem
{
    UIBarButtonItem *refreshItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(leftItemClicked)];
    self.navigationItem.leftBarButtonItem = refreshItem;
    [refreshItem release];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
